#pragma once

///////////////////////////////////////////////////////////////
//
// Structures and functions for lighting calculations.
// Ambient, Diffuse and Specular are rgb colors
//
///////////////////////////////////////////////////////////////

#include <DirectXMath.h>
#include <windows.h>

//////////////////////////////////////////////////////////////////////////
//
// Make sure structure alignment agrees with HLSL structure padding rules. 
// Elements are packed into 4D vectors with the restriction that an element
// cannot straddle a 4D vector boundary.
//
//////////////////////////////////////////////////////////////////////////

struct DirectionalLight {
    DirectX::XMFLOAT4A mAmbient;
    DirectX::XMFLOAT4A mDiffuse;
    DirectX::XMFLOAT4A mSpecular;

    DirectX::XMFLOAT3A mDir;

    DirectionalLight();
};

struct PointLight {
    DirectX::XMFLOAT4A mAmbient;
    DirectX::XMFLOAT4A mDiffuse;
    DirectX::XMFLOAT4A mSpecular;

    // Packed into 4D vector: (Position, Range)
    DirectX::XMFLOAT4A mPosRange;

    DirectX::XMFLOAT3A mAttenuation;
    
    PointLight();
};

struct SpotLight {
    DirectX::XMFLOAT4A mAmbient;
    DirectX::XMFLOAT4A mDiffuse;
    DirectX::XMFLOAT4A mSpecular;

    // Packed into 4D vector: (Position, Range)
    DirectX::XMFLOAT4A mPosRange;

    // Packed into 4D vector: (Direction, Spot)
    DirectX::XMFLOAT4A mDirSpot;

    DirectX::XMFLOAT3A mAttenuation;

    SpotLight();
};

struct Material {    
    DirectX::XMFLOAT4A mAmbient;
    DirectX::XMFLOAT4A mDiffuse;

    // x, y, z are specular rgb colors respectively
    // w is used for specular power
    DirectX::XMFLOAT4A mSpecular; 

    DirectX::XMFLOAT4A mReflect;

    Material();
};